import request from '@/utils/request'

/**
 * 订单查询
 * @param {Object} params
 * @returns
 */
export function getOrderList(params) {
  return request({
    url: '/org/orderList',
    method: 'get',
    params
  })
}
/**
 * 设备订单查询
 * @param {Object} params
 * @returns
 */
export function getDeviceOrderApi(params) {
  return request({
    url: '/org/orderList/getDeviceOrder',
    method: 'get',
    params
  })
}

/**
 * 订单详情
 * @param {String | Number} id
 * @returns
 */
export function getOrderDetailById(id) {
  return request({
    url: `/org/orderList/${id}`,
    method: 'get'
  })
}

/**
 * 订单详情退款金额
 * @param {String | Number} orderId
 * @returns
 */
export function getOrderRefundAmount(orderId) {
  return request({
    url: `/org/orderList/calculate`,
    method: 'get',
    params: { orderId }
  })
}

/**
 * 订单异常标记
 * @param {Object} data
 * @returns
 */
export function markOrder(data) {
  return request({
    url: `/org/orderList/updateException`,
    method: 'put',
    data
  })
}

/**
 * 订单退款
 * @param {Object} data
 * @returns
 */
export function refundOrder(data) {
  return request({
    url: `/org/orderList/refund`,
    headers: { repeatSubmit: false },
    method: 'post',
    data
  })
}

/**
 * 批量退款
 * @param {Object} data
 * @returns
 */
export function postBatchRefundOrderApi(data) {
  return request({
    url: `/org/orderList/refund/batch`,
    headers: { repeatSubmit: false },
    method: 'post',
    data
  })
}

/**
 * 套餐数据统计
 * @param {Object} params
 * @returns
 */
export function getComboReport(params) {
  return request({
    url: `/org/orderList/comboStatistics`,
    method: 'get',
    params
  })
}

/**
 * 商品数据统计
 * @param {Object} params
 * @returns
 */
export function getGoodsReport(params) {
  return request({
    url: `/org/orderList/tagStatistics`,
    method: 'get',
    params
  })
}

/**
 * 套餐数据汇总
 * @param {Object} orderSn
 * @param {Object} enterpriseName
 * @param {Object} startTime
 * @param {Object} endTime
 * @param {Object} provinces
 * @returns
 */
export function postPackageDataSummaryApi(data) {
  return request({
    url: `/group/enterpriseOrder/comboCollect`,
    method: 'post',
    data
  })
}

/**
 * 企业订单管理列表
 * @param {Object} orderSn
 * @param {Object} enterpriseName
 * @param {Object} startTime
 * @param {Object} endTime
 * @param {Object} provinces
 * @returns
 */
export function postEnterpriseOrderListApi(data) {
  return request({
    url: `/group/enterpriseOrder/enterpriseOrder`,
    method: 'post',
    data
  })
}

/**
 * 订单详情列表
 * @param {Object} enterpriseOrderSn
 * @param {Object} mobile
 * @param {Object} remark
 * @returns
 */
export function getEnterpriseOrderDetailsListApi(params) {
  return request({
    url: `/group/enterpriseOrder/orderDetail`,
    method: 'get',
    params
  })
}
